package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CheckItemDao {
    Page<CheckItem> findPage(QueryPageBean queryPageBean);
    @Select("SELECT\n" +
            "  `id`,\n" +
            "  `code`,\n" +
            "  `name`,\n" +
            "  `sex`,\n" +
            "  `age`,\n" +
            "  `price`,\n" +
            "  `type`,\n" +
            "  `attention`,\n" +
            "  `remark`\n" +
            "FROM `t_checkitem` where id = #{id}")
    CheckItem findById(Integer id);

    CheckItem findCheckItemById(Integer id);

    @Insert("INSERT INTO t_checkitem" +
            " (code,name,sex,age,price,type,attention,remark)" +
            "  VALUES (#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})")
    void add(CheckItem checkItem);
    @Delete("DELETE FROM t_checkitem WHERE id = #{id}")
    void delete(Integer id);

    void update(CheckItem checkItem);

    @Select("select * from t_checkitem")
    List<CheckItem> findAll();
}
